<template>
	<manage-table
		:service="service"
		:default-record="defaultRecord"
		:options="options"
		ref="manageTable"
	/>
</template>

<script>
	import { defaultAvatar } from '@/settings';
	import ManageTable from '@/components/ManageTable/ManageTable.vue';
	import ManageTableRouter from '@/components/ManageTable/ManageTableRouter';
	import { userService } from '@/services/authorization/User';

	export default {
		name: 'UserTable',
		components: {
			ManageTable
		},
		mixins: [ManageTableRouter],
		data() {
			return {
				service: userService,
				defaultRecord: {
					id: null,
					username: null,
					gender: false,
					nickname: null,
					phone: null,
					email: null,
					avatar: defaultAvatar,
					status: 0
				},
				options: [
					{
						label: '用户名',
						value: 'username'
					},
					{
						label: '性别',
						value: 'gender',
						type: 'category',
						options: [
							{
								label: '男',
								value: false
							},
							{
								label: '女',
								value: true
							}
						]
					},
					{
						label: '昵称',
						value: 'nickname'
					},
					{
						label: '电话',
						value: 'phone'
					},
					{
						label: '邮箱',
						value: 'email'
					},
					{
						label: '头像',
						value: 'avatar',
						editable: false
					},
					{
						label: '状态',
						value: 'status',
						type: 'category',
						options: [
							{
								label: '无法使用',
								value: 0
							},
							{
								label: '正常',
								value: 1
							}
						]
					}
				]
			};
		}
	};
</script>
